<template>
    <div>
        <el-card>
            <el-button type="info" icon="el-icon-arrow-left" size="mini" @click="myReturn">返回</el-button>
            <el-form ref="form" :model="form">
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="活动区域">
                            <span slot="label">
                                <span class="label-text">
                                    类型
                                </span>
                            </span>

                            <el-input v-model="form.type" disabled></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item>
                            <span slot="label">
                                <span class="label-text">
                                    备注
                                </span>
                            </span>
                            <el-input v-model="form.memo"></el-input>
                        </el-form-item>

                    </el-col>

                </el-row>
                <el-form-item class="sub-btn">
                    <el-button type="primary" @click="saveChangAtt">保存</el-button>
                    <el-button @click="myCancel">取消</el-button>
                </el-form-item>
            </el-form>

        </el-card>

    </div>
</template>

<script>


export default {
    name: "changCheman",
    data() {
        return {
            form: {
                memo: "",
                type: 0,
            },
            myType: [],
        }
    },
    methods: {
        myReturn() {
            this.$router.push("/chenManage")
        },
        //根据id回显考勤信息
        async getChangAtt() {
            let res = await this.$api.checking.getChangAtt({ id: this.$route.query.id });
            this.myType.push(res.data.data)
            // console.log(res.data.data);
            console.log(this.myType);
            this.form.memo=this.myType[0].memo;
            this.form.type=this.myType[0].type;


        },
        //修改考勤信息
        async saveChangAtt() {
            
            let res = await this.$api.checking.postChangAtt({ id: this.$route.query.id, memo: this.form.memo });
            console.log(res);
            this.$router.push("/chenManage")
            
        },
        //返回考勤页
        myCancel() {
            this.$router.push("/chenManage")
        }

    },
    created() {
        this.getChangAtt()
    }

}
</script>

<style  scoped>
.label-text {
    font-weight: 700;
    font-size: 14px;
    color: #333;
}

.sub-btn {
    margin-top: 20px;
    text-align: left;
}

;
</style>